﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

namespace Jackie.Silverliight.SetpBySetp.Html
{
    public partial class BrowserInfomation : Page
    {
        public BrowserInfomation()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(BrowserInfomation_Loaded);
        }

        void BrowserInfomation_Loaded(object sender, RoutedEventArgs e)
        {
            BrowserInformation info = HtmlPage.BrowserInformation;

            name.Text = info.Name;
            browserVersion.Text = info.BrowserVersion.ToString();
            cookieEnable.Text = info.CookiesEnabled.ToString();
            platform.Text = info.Platform;
            userAgent.Text = info.UserAgent;
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        private void btnHtmlEncode_Click(object sender, RoutedEventArgs e)
        {
            this.txtHtmlDecode.Text = HttpUtility.HtmlEncode(this.txtHtmlEncode.Text);
        }

        private void btnHtmlDecode_Click(object sender, RoutedEventArgs e)
        {
            this.txtHtmlEncode.Text = HttpUtility.HtmlDecode(this.txtHtmlDecode.Text);
        }

        private void btnUrlEncode_Click(object sender, RoutedEventArgs e)
        {
            this.txtUrlDecode.Text = HttpUtility.UrlEncode(this.txtUrlEncode.Text);
        }

        private void btnUrlDecode_Click(object sender, RoutedEventArgs e)
        {
            this.txtUrlEncode.Text = HttpUtility.UrlDecode(this.txtUrlDecode.Text);
        }

    }
}
